package com.ryskoo.customer.customerintegrallog.service;

import com.ryskoo.customer.customerintegrallog.domain.CustomerIntegralLogPO;
import com.ryskoo.customer.customerintegrallog.repository.ICustomerIntegralLogRepository;
import com.ryskoo.framework.core.service.BasicServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @author BeHappy
 */
@Service
public class CustomerIntegralLogServiceImpl extends BasicServiceImpl<CustomerIntegralLogPO> implements ICustomerIntegralLogService {
    @Autowired
    private ICustomerIntegralLogRepository customerIntegralLogRepository;

    @PostConstruct
    public void init() {
        this.setDao(customerIntegralLogRepository);
    }

    @Override
    public void createLog(String integralUuid, String orderId, int integral, int type) {
        CustomerIntegralLogPO po = new CustomerIntegralLogPO();
        po.setIntegralUuid(integralUuid);
        po.setOrderId(orderId);
        po.setIntegral(integral);
        po.setType(type);
        this.create(po);
    }
}
